<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta charset="utf-8"/>
<title>Quản lí sản phẩm</title>
<link rel="stylesheet" href="Css/cc.css"></link>
</head>
<body>
<div class="wrapper">
<?php include 'connect.php';?>
<?php include 'menu.php';?>
<div class="content">
    <?php
        $limit = 8;
        if (isset($_GET['page'])) 
            {
                $page = $con->real_escape_string($_GET['page']);
            } 
        else 
            {
                $page = 1;
            }
        if (isset($_GET["on"]))
        {
        $query = $con->query("Select count(*) from product");
        $row3 = mysqli_fetch_array($query);
        $tongsp = $row3[0];
        $pages = ceil($tongsp / $limit);
        $offset = ($page - 1) * $limit;
        $result = $con->query("select * from product LIMIT {$limit} offset {$offset}"); ?>
        <div><br></br><a href="update.php?a=a">Thêm mới</a> / <a href="javascript:history.go(-1)">Quay lại</a>
        <table border="1" width="95%" style="margin: 20px auto">
            <th>Tên SP</th><th>Ảnh</th><th>Kích cỡ</th><th>Thông tin</th><th>DM cha</th><th>DM con</th><th>Tùy chọn</th>
        <?php
        while ($value = mysqli_fetch_array($result)){ ?>
            <tr>
                <td width="5%"><?php echo $value['name'] ?></td><td width="8%"><div class="imag"><img src="<?php echo $value["image"] ?>"/></div></td><td width="5%">Đủ size</td><td width="20%"><?php echo $value['info'] ?></td><td width="5%"><?php echo $value['categoryid'] ?></td><td width="5%"><?php echo $value['categorydetailid'] ?></td><td width="10%"><a href="delete.php?xoa2=<?php echo $value['id'] ?>">Xóa</a> / <a href="update.php?cn=<?php echo $value['id'] ?>">Cập nhật</a></td>
            </tr>
        <?php } ?>
        </table>
        </div>
        <a href="update.php?a=a">Thêm mới</a> / <a href="javascript:history.go(-1)">Quay lại</a><br></br>
        <?php } ?>
        <?php 
        if (isset($_GET["on2"]))
        {
        $query = $con->query("Select count(*) from footwear");
        $row3 = mysqli_fetch_array($query);
        $tongsp = $row3[0];
        $pages = ceil($tongsp / $limit);
        $offset = ($page - 1) * $limit;
        $result = $con->query("select * from footwear LIMIT {$limit} offset {$offset}"); ?>
         <div><br></br>
        <a href="update.php?b=b">Thêm mới</a> / <a href="javascript:history.go(-1)">Quay lại</a>
        <table border="1" width="95%" style="margin: 20px auto">
            <th>Tên SP</th><th>Ảnh</th><th>Kích cỡ</th><th>Thông tin</th><th>DM cha</th><th>DM con</th><th>Tùy chọn</th>
        <?php
        while ($value = mysqli_fetch_array($result)){ ?>
            <tr>
                <td width="5%"><?php echo $value['name'] ?></td><td width="8%"><div class="imag"><img src="<?php echo $value["image"] ?>"/></div></td><td width="5%">Đủ size</td><td width="20%"><?php echo $value['info'] ?></td><td width="5%"><?php echo $value['category_foot'] ?></td><td width="5%">Null</td><td width="10%"><a href="delete.php?xoa3=<?php echo $value['id'] ?>">Xóa</a> / <a href="update.php?cn2=<?php echo $value['id'] ?>">Cập nhật</a></td>
            </tr>
        <?php } ?>
        </table>
        </div>
        <a href="update.php?b=b">Thêm mới</a> / <a href="javascript:history.go(-1)">Quay lại</a><br></br>
        <?php } ?>
</div>
<div class="pages">
         <?php
         if (isset($_GET['on']))
         {
             for($i=1;$i <= $pages; $i++)
            {
                echo "<a href=\"product_manager.php?on={$i}&&page={$i}\">{$i}</a> "." ";
            }
         }
         elseif (isset($_GET['on2']))
         {
             for($i=1;$i <= $pages; $i++)
            {
                echo "<a href=\"product_manager.php?on2={$i}&&page={$i}\">{$i}</a> "." ";
            }
         }
         else
          {
            for($i=1;$i <= $pages; $i++)
            {
                echo "<a href=\"?page={$i}\">{$i}</a> "." ";
            }
          }
         ?>
    </div>
<div class="footer">
We are... Mr.Chuot Tru, Mr.Minh Ho
<hr  width="20%" style="margin-left:40%; margin-top:8px;"/>
<pre><br /><br />
Coppyright: Aitieducation
</pre>
</div>
</div>
</div>
</body>
</html>
</html>